"""首页搜索商品(代发商品)"""
import allure
from page.search_df_page.search_df_dict import get_mall_xpath
from base.WebKeys import WebKeys
class MallFlow_search_df(WebKeys):

    def xl_search(self):
        """xl-搜索商品 代发"""
        with allure.step("点击搜索框 输入商品内容"):
            self.input_content(get_mall_xpath('Search_box'),get_mall_xpath('txt'))

        with allure.step("点击搜索按钮"):
            self.wait_click(get_mall_xpath('Search button'))

        with allure.step("点击商品 进入商品详情"):
            self.wait_click(get_mall_xpath('txt_box'))
        #
        with allure.step("切换到最新窗口"):
            self.switch_to_tab(-1)

        with allure.step("加入购物车"):
            self.is_element_present(get_mall_xpath('Add_to_cart'),8)
            # self.wait_click(get_mall_xpath('Add_to_cart'))

    # def get_result_true(self):
    #     """断言加入购物车成功提示语"""
    #     Assertion = '//*[@id="ant-message"]/span/div/div'
    #     result=self.read(Assertion)
    #     return result

if __name__ == '__main__':
    m = MallFlow_search_df()
    m.xl_search()